<?php
namespace app\wxapp\service;
use app\common\model\Topic as TopicModel;
use app\common\model\VideoList as VideoListModel;
use think\facade\Db;

/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2020/10/20 0020
 * Time: 9:14
 */
class TopicService {

    /**
     * @param $id
     * @return array|null|\think\Model
     */
    public function getOne($id){
        $topic = Db::table("topic")->where(['id'=>$id])->find();
        $subVideoList = Db::table('video_list')->where(['topic_id'=>$id])->order('sort','asc')->select()->toArray();
        $topic['sub'] = $subVideoList;
        return $topic;
    }

}